In data communication, packet processing of a data communication device generally includes packet forwarding and stream forwarding. Compared with the packet forwarding, a subsequent forwarding of the stream forwarding needs to look up a stream table only once, which reduces the number of times of table lookup. Further, the stream forwarding adopts exact match search, which reduces the forwarding delay. The stream table may include multiple stream forwarding entries, and the stream forwarding entry generally includes stream processing information of the data communication device.
Currently, in the data communication device, a stream forwarding entry is created in the following way. After receiving a packet, the data communication device judges whether the stream corresponding to the packet has a stream forwarding entry; if the stream has a stream forwarding entry, the data communication device forwards the packet according to the stream forwarding table entry; while if the stream has no stream forwarding entry, the data communication device creates a stream forwarding entry for the stream corresponding to the packet, and forwards the packet.
In the process of implementing the present disclosure, the inventor finds that in the prior art, stream forwarding entries need to be created for all packets that lack the corresponding stream forwarding entries, so the number of the stream forwarding entries in the stream table is huge, a large storage space is required, and the maintenance of the stream table is complicated; moreover, the data communication device is vulnerable to attacks of denial of service (DOS, Denial of Service) and is poorly secure.